/**
 * router.js处理业务逻辑
 */
const db = require('./database');

const Router = {
  newsList: async (req, res) => {
    const data = await db.query('select * from TB_NEWS');
    console.log(data);
    res.writeHead(200, { 'Content-Type': 'application/json' });
    res.write(JSON.stringify(data));
    res.end();
  },
  noResult: (req, res) => {
    res.write(JSON.stringify({
      data: '该接口正在开发中',
    }));
    res.end();
  },
};

module.exports = Router;